<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5shiv.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<![endif]-->
	<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.css" />
	<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
	<!--[if IE 6]>
<script type="text/javascript" src="/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
	<title></title>

</head>

<body>
	<article class="page-container">
		<div class="panel panel-default">
			<div class="panel-header">基础信息</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">条形码：{{ $data_basic->bar_code }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">样品名称：{{ $data_basic->sample_name }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">分类：{{ $data_basic->class1 }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">电压等级：{{ $data_basic->voltage_level }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">执行标准：{{ $data_basic->biaozhun }}</div>
			<div style="clear:both"></div>
		</div>
		<div class="panel panel-default mt-20">
			<div class="panel-header">执行标准内容（{{ $data_basic->biaozhun }}）</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">试验电压：{{ $data_test->parm1 }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">持续时间：{{ $data_test->parm2 }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">泄漏电流：≤{{ $data_test->parm3 }}</div>
			<div class="mt-10 mr-15 mb-10 ml-15 f-l">试验周期：<span id="cycle">{{ $data_test->cycle != "0.5年" ? $data_test->cycle : "半年" }}</span></div>
			<div style="clear:both"></div>
		</div>
		<form id="form_edit" autocomplete="off">
			<div class="panel panel-default mt-20">
				<div class="panel-header">试验记录</div>
				<div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						温度：<input type="text" name="wendu" id="wendu" value="{{ $data_test->wendu }}" class="input-text radius" style="width:80px;text-align:center"> ℃
					</div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						湿度：<input type="text" name="shidu" id="shidu" value="{{ $data_test->shidu }}" class="input-text radius" style="width:80px;text-align:center"> %
					</div>
					<div style="clear:both"></div>
				</div>
				<div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						试验电压：<input type="text" name="test_voltage" id="test_voltage" value="{{ $data_test->test_voltage }}" class="input-text radius" style="width:80px;text-align:center"> kV
					</div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						持续时间：<input type="text" name="test_time" value="{{ $data_test->test_time }}" class="input-text radius" style="width:80px;text-align:center"> min
					</div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						泄漏电流：<input type="text" name="test_leakagecurrent" value="{{ $data_test->test_leakagecurrent }}" class="input-text radius" style="width:80px;text-align:center"> mA
					</div>
					<div style="clear:both"></div>
				</div>
				<div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						试验日期：<input type="text" id="test_date" name="test_date" value="{{ $data_basic->test_date }}" readonly onfocus="WdatePicker({onpicked:function(){calcu_date();},oncleared:function(){clear_date();},maxDate:'%y-%M-%d'})" class="input-text radius Wdate" style="width:120px;">
					</div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						下次试验日期：<input type="text" id="next_date" name="next_date" value="{{ $data_basic->next_date }}" class="input-text radius" readonly style="width:100px;text-align:center">
					</div>
					<div style="clear:both"></div>
				</div>
				<div>
					<div class="mt-10 mr-15 mb-10 ml-15 f-l">
						结论：
						<span class="select-box radius" style="width:80px">
						<select class="select" size="1" name="jielun">
							<option @if ($data_basic->jielun === 0)selected @endif value="0"></option>
							<option @if ($data_basic->jielun === 1)selected @endif value="1">合格</option>
							<option @if ($data_basic->jielun === 2)selected @endif value="2">不合格</option>
						</select>
						</span>
					</div>
					<div style="clear:both"></div>
				</div>
			</div>
			<input type="hidden" name="table_name_val" value="{{ $table_name_val }}">
			<input type="hidden" name="data_test_id" value="{{ $data_test->id }}">
			@csrf
			<div class="f-r mt-20">
				@if (!isset($_GET['check']))
				<input class="btn btn-primary radius mr-15" type="submit" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
				@endif
				@if (!isset($_GET['phoneView']))
				<input class="btn btn-danger radius mr-15" type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;" onclick="layer_close();">
				@endif
			</div>
		</form>
	</article>

	<!--_footer 作为公共模版分离出去-->
	<script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="/admin/lib/layer/3.1.1/layer.js"></script>
	<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
	<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
	<!--/_footer 作为公共模版分离出去-->

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript">
		//计算下次试验日期  calcu_date
		function calcu_date(){
		
			var s = $('#test_date').val(); 
			var d = new Date(Date.parse(s.replace(/-/g, "/")));

			//获取试验周期
			var cycle = $("#cycle").text();
			if (cycle === '半年') {
				GetNextDate("m", 6, d);
			} else {
				cycle = parseInt(cycle);
				GetNextDate("y", cycle, d);
			}
			next_date = d.Format("yyyy-MM-dd");
			// next_date = next_date.toLocaleDateString();
			$('#next_date').val(next_date);
		}

		// 当点击WdatePicker控件的清空按钮时，清空下次试验日期  clear_date
		function clear_date(){
			$('#next_date').val('');
		}

		$(function(){
			/* 审核人员查看报告时，禁止编辑 */
			//审核人员打开页面没有保存按钮，所以dom类型是 undefined
            dom=$('input:submit').val();
			if (typeof(dom)=='undefined') {
				$('input').attr("readonly","readonly");
				$('select,#test_date').attr("disabled","true");
			}
			/* 审核人员查看报告时，禁止编辑 */

            var index2;

            $('.skin-minimal input').iCheck({
                checkboxClass: 'icheckbox-blue',
                radioClass: 'iradio-blue',
                increaseArea: '20%'
            });
            
            $("#form_edit").validate({
                rules:{
                    wendu:{
                        isNumber:true
                    },
                    shidu:{
                        isNumber:true
                    },
                    test_voltage:{
                        isNumber:true
                    },
                    test_time:{
                        isNumber:true
                    },
                    test_leakagecurrent:{
                        isNumber:true
                    },
                    test_date:{
                        required:true
                    },
              
				},
			/* 	messages : {
					wendu : {
						isNumber : '不是数值',
					},
					
				}, */
                // onkeyup:false,
                // focusCleanup:false,
                success:"valid",
                submitHandler:function(form){
                   $(form).ajaxSubmit({ 
                        type: 'post', 
                        url: "",//自己提交给自己可以不写url   
                        //beforeSend  beforeSubmit
                        
                        beforeSend : function () { 
                            //0.4透明度 白色遮罩
                           index2 = layer.load(2,{ shade: [0.3,'#fff'] }); 
                        },
                        complete : function () { 
                            layer.close(index2); 
                        },
                        success: function(data) {
                            //判断添加结果 
                            if(data === '1'){ 
                                parent.table_reload(0);//0停留在当前页，1回到第一页
                                parent.parent.layer.msg('操作成功!',{ icon: 1, time:2000 });
                                layer_close();
                            }else{
                                layer.msg('操作失败!', { icon: 2, time: 2000 }); 
                            } 
                        }, 
                        error: function(data) {
                            ajax_error(data);
                        }
                    }); 
                }
            });
        });
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</body>

</html>